package com.teach.gui.until;

import com.teach.gui.Constaint.Constant;
import com.teach.gui.GUITest;

import java.awt.*;

/**
 * CLASS:GUITest03：
 * TODU:地球按照椭圆轨迹
 * date:2021/1/25、20:08
 * version:0.1
 */
public class GUITest06 extends MyFrame{
    public Image bg = ImageUutil.getImage("img/bg.jpg");
    public Image erath = ImageUutil.getImage("img/earth.jpg");
    public int x;
    public int y=50;
    public boolean right;
    public int longAxis;
    public int shortAxis;
    public double o;
    public double speed;
    public double r;
    public GUITest06(){
        super.init("03");
        this.x = x+Constant.WINDOW_HEIGH/2;
        this.y = y;
        this.longAxis=400;
        this.shortAxis=200;
        this.speed=0.1;
    }

    public int w;
    public  int h;
    @Override
    public void paint(Graphics g) {
        g.drawImage(bg,0,0,null);
        g.drawImage(erath,x,y,null);
        r=10*o;
        x=(int) (30*Math.sqrt(2*Math.cos(2*o)*Math.cos(o))+Constant.WINDOE_WIDTH/2);
        y=(int) (30*Math.sqrt(2*Math.cos(2*o)*Math.sin(o))+Constant.WINDOW_HEIGH/2);
        o+=speed;

    }

    public static void main(String[] args) {
        new GUITest06();
    }
}
